package com.yyjj.yyjj.common.auth;


import com.yyjj.yyjj.vo.user.UserLoginVo;

//ThreadLocal工具类
public class AuthContextHolder {

    //用户id
    private static ThreadLocal<Long> userId=new ThreadLocal<>();
    //用户仓库id
    private static ThreadLocal<Long> wareId=new ThreadLocal<>();
    //用户信息对象
    private static ThreadLocal<UserLoginVo> userLoginVo =new ThreadLocal<>();

    //userId操作的方法
    public  static  void setUserId(Long _userId){
        userId.set(_userId);
    }
    public static  Long getUserId(){
        return  userId.get();
    }

    //wareId操作的方法
    public static void setWareId(Long _wareId){
        wareId.set(_wareId);
    }
    public static Long getWareId(){
        return wareId.get();
    }

    public static UserLoginVo getUserLoginVo() {
        return userLoginVo.get();
    }

    public static void setUserLoginVo(UserLoginVo _userLoginVo) {
        userLoginVo.set(_userLoginVo);
    }

}
